package com.atguigu.spring.service.impl;

import com.atguigu.spring.service.BookService;
import com.atguigu.spring.service.CheckOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 林允
 * @version 1.0
 * @description: TODO
 * @date 2023/5/10 11:20
 */
@Service
public class CheckOutServiceImpl implements CheckOutService {

    @Autowired
    private BookService bookService;

    @Override
    //@Transactional
    public void checkOut(Integer userId, Integer[] bookIds) {
        for (Integer bookId : bookIds){
            bookService.buyBook(userId, bookId);
        }
    }
}
